package com.songhuan.web.controller;
import com.songhuan.web.dto.*;
import com.songhuan.web.dto.query.*;
import com.songhuan.web.entity.*;
import com.songhuan.web.mapper.*;
import com.songhuan.web.service.*;
import com.songhuan.web.tools.dto.*;
import com.songhuan.web.dto.LeaveRecordDto;
import com.songhuan.web.dto.query.LeaveRecordPagedInput;
import com.songhuan.web.mapper.LeaveRecordMapper;
import com.songhuan.web.service.LeaveRecordService;
import com.songhuan.web.tools.dto.IdInput;
import com.songhuan.web.tools.dto.IdsInput;
import com.songhuan.web.tools.dto.PagedResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import lombok.SneakyThrows;

/**
 * 请假记录控制器
 */
@RestController()
@RequestMapping("/LeaveRecord")
public class LeaveRecordController {
    @Autowired()
    private LeaveRecordService _LeaveRecordService;
    @Autowired()
    private LeaveRecordMapper _LeaveRecordMapper;
    /**
     * 请假记录分页查询
     */
    @RequestMapping(value = "/List", method = RequestMethod.POST)
    @SneakyThrows
    public PagedResult<LeaveRecordDto> List(@RequestBody LeaveRecordPagedInput input)  {
        return _LeaveRecordService.List(input);
    }
     /**
     * 单个请假记录查询接口
     */
    @RequestMapping(value = "/Get", method = RequestMethod.POST)
    @SneakyThrows
    public LeaveRecordDto Get(@RequestBody LeaveRecordPagedInput input) {

        return _LeaveRecordService.Get(input);
    }
  
    /**
     * 请假记录创建或则修改
     */
    @RequestMapping(value = "/CreateOrEdit", method = RequestMethod.POST)
    public LeaveRecordDto CreateOrEdit(@RequestBody LeaveRecordDto input) throws Exception {
        return _LeaveRecordService.CreateOrEdit(input);
    }
    /**
     * 请假批准
     */
    @RequestMapping(value = "/ApplySuccess", method = RequestMethod.POST)
    public void ApplySuccess(@RequestBody LeaveRecordDto input) throws Exception {
         _LeaveRecordService.ApplySuccess(input);
    }
    /**
     * 请假记录删除
     */
    @RequestMapping(value = "/Delete", method = RequestMethod.POST)
    public void Delete(@RequestBody IdInput input)
    {
        _LeaveRecordService.removeById(input.getId());
    }

    /**
     * 请假记录批量删除
     */
    @RequestMapping(value = "/BatchDelete", method = RequestMethod.POST)
    public void BatchDelete(@RequestBody IdsInput input)
    {
        _LeaveRecordService.removeByIds(input.getIds());
    }

 
}
